SG Window Window Object
SetPaintCallback Method

©1998 by Stinga

Properties     Methods      Events     Constants     Error Codes
Description

Set interface whose methods will be called when there are new WM_PAINT or WM_NCPAINT messages in the attached window message queue.

Syntax

object.SetPaintCallback(sink As Object)

Part Description
object The object is expression that evaluates to Window object
sink Required. Object that implements IsgPaintSink interface.
Remarks

SG Window enables you to handle paint messages with fast IsgPaintSink callback interface. When this interface is implemented and registered with SetPaintCallback method, Window object will call GetFlags method to determine what to paint and what interface methods to call. 

Example

Following example shows how to implement and use IsgPaintSink interface in the class module:

' Declare interface
Implements IsgPaintSink

' SGWindow object
Private mWnd As SGWindow.Window

Private Sub Class_Initialize()
   ' Initialize SGWindow object
   Set mWnd = New SGWindow.Window
   mWnd.Hooked = True
   mWnd.SetPaintCallback Me
End Sub

Private Function IsgPaintSink_GetFlags() As sgWindow.PaintFlag
   ' Draw client area, and use default frame painting
   IsgPaintSink_GetFlags = pfClientPaint
End Function

Private Sub IsgPaintSink_FramePaint(ByVal hdc As Long)
   ' Use default frame painting
End Sub

Private Sub IsgPaintSink_ClientPaint(ByVal hdc As Long, ByVal left As Long, ByVal top As Long, ByVal right As Long, ByVal bottom As Long)
   ' Draw rectangle over whole client area
   Dim rc As RECT
   GetClientRect mWnd.HWND, rc
   Rectangle hdc, 0, 0, rc.right, rc.bottom
End Sub